<template>
    <el-dialog v-model="dialogVisible" :title="'详情'">
        <xkl-text-form :form="infoForm"></xkl-text-form>
        <template #footer>
            <el-button @click="close()">取消</el-button>
        </template>
    </el-dialog>
</template>
<script setup lang="ts">
export interface DialogDetailInstance {
    init: (id?: number) => void
}
import { ref } from 'vue';
import User from '@admin/entity/system/user/User';
import UserService from '~/service/module/system/user';
const userService = new UserService()

const infoForm = new User({
    span: 12
}).active

const dialogVisible = ref(false)

const init = (id?: number) => {
    dialogVisible.value = true

    if (id) {
        infoForm.deptId = id
        getDeptById(infoForm.deptId)
    }
}

const getDeptById = async (id: number) => {
    const res = await userService.getById(id)
    if (res.SUCCESS) {
        infoForm.setForm(res.data)
    }
}

const close = () => {
    dialogVisible.value = false
}



defineExpose({ init })
</script>
<style lang="scss" scoped></style>